package cn.com.xky.properties.web;

import cn.com.xky.properties.config.DemoProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * Created by EKEYXIA on 2017/8/9.
 */
@RestController//返回String字符串
public class Controller {

    @Autowired//得到DemoProperties的实例
    private DemoProperties demoProperties;

    @GetMapping(value = "/hello")//设置一个get请求的处理，路径为/hello
    public String hello(){
        String name = demoProperties.getName();
        String sex = demoProperties.getSex();
        Integer phone = demoProperties.getPhone();
        String homeName = demoProperties.getHomeName();
        String homeProvince = demoProperties.getHomeProvince();
        return "name :" +name +" sex :" + sex + " phone :"+phone+ "homeName : " +homeName +" homeProvince : "+ homeProvince;
    }

    @GetMapping(value = "/properties")
    public String properties(){
        String properties = demoProperties.getProperties();
        return "properties : " + properties;
    }

    @GetMapping(value = "/userInfo")
    public String userInfo(){
        Long userId = demoProperties.getUserID();
        Integer age = demoProperties.getUserAge();
        String desc = demoProperties.getUserDesc();
        String uuid = demoProperties.getUserUuid();
        return "userId : " + userId + " age :  " +age +" desc  : " +desc + " uuid : " +uuid;
    }

}
